<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <artifactId>camunda-qa-integration-tests-webapps-standalone-engine</artifactId>
  <name>Camunda Platform - QA Integration Tests - Webapps Standalone Engine</name>

  <parent>
    <groupId>org.camunda.bpm.qa</groupId>
    <artifactId>camunda-qa-integration-tests-webapps-root</artifactId>
    <version>7.20.0-SNAPSHOT</version>
    <relativePath>../</relativePath>
  </parent>

  <dependencies>
    <dependency>
      <groupId>org.camunda.bpm.qa</groupId>
      <artifactId>camunda-qa-integration-tests-webapps</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>com.konghq</groupId>
      <artifactId>unirest-java</artifactId>
      <version>2.3.10</version>
      <classifier>standalone</classifier>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <profiles>
    <profile>
      <id>wildfly26-vanilla</id>

      <properties>
        <jboss.runtime>${basedir}/../../vanilla-runtimes/wildfly26/target/server/wildfly-${version.wildfly26}</jboss.runtime>
        <http.port>${jboss.http.port}</http.port>
      </properties>

      <dependencies>
        <dependency>
          <groupId>org.camunda.bpm.webapp</groupId>
          <artifactId>camunda-webapp-jboss-standalone</artifactId>
          <version>${project.version}</version>
          <type>war</type>
          <scope>test</scope>
        </dependency>
      </dependencies>

      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.cargo</groupId>
            <artifactId>cargo-maven3-plugin</artifactId>
            <executions>
              <execution>
                <id>start-container</id>
                <phase>pre-integration-test</phase>
                <goals>
                  <goal>start</goal>
                </goals>
              </execution>
              <execution>
                <id>stop-container</id>
                <phase>post-integration-test</phase>
                <goals>
                  <goal>stop</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <!-- Container configuration -->
              <container>
                <type>installed</type>
                <containerId>${cargo.wildfly26.container.id}</containerId>
                <append>false</append>
                <home>${jboss.runtime}</home>
                <timeout>${cargo.timeout}</timeout>
              </container>
              <configuration>
                <type>standalone</type>
                <home>${project.build.directory}/config-wildfly</home>
                <properties>
                  <cargo.servlet.port>${jboss.http.port}</cargo.servlet.port>
                  <cargo.jboss.ajp.port>${jboss.ajp.port}</cargo.jboss.ajp.port>
                  <cargo.jvmargs>-Djava.net.preferIPv4Stack=true</cargo.jvmargs>
                </properties>
              </configuration>
              <deployables>
                <deployable>
                  <groupId>org.camunda.bpm.webapp</groupId>
                  <artifactId>camunda-webapp-jboss-standalone</artifactId>
                  <type>war</type>
                  <pingURL>http://localhost:${jboss.http.port}/camunda</pingURL>
                  <pingTimeout>${cargo.deploy.timeout}</pingTimeout>
                </deployable>
              </deployables>
            </configuration>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-failsafe-plugin</artifactId>
            <configuration>
              <excludes combine.children="append">
                <!-- CAM-14109 -->
                <exclude>**/SessionCookieSameSiteIT.java</exclude>
              </excludes>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>tomcat-vanilla</id>

      <properties>
        <tomcat.runtime>${basedir}/../../vanilla-runtimes/tomcat/target/server/apache-tomcat-${version.tomcat}</tomcat.runtime>
        <http.port>${tomcat.connector.http.port}</http.port>
      </properties>

      <dependencies>
        <dependency>
          <groupId>org.camunda.bpm.webapp</groupId>
          <artifactId>camunda-webapp-tomcat-standalone</artifactId>
          <version>${project.version}</version>
          <type>war</type>
          <scope>test</scope>
        </dependency>
      </dependencies>

      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.cargo</groupId>
            <artifactId>cargo-maven3-plugin</artifactId>
            <executions>
              <execution>
                <id>start-container</id>
                <phase>pre-integration-test</phase>
                <goals>
                  <goal>start</goal>
                </goals>
              </execution>
              <execution>
                <id>stop-container</id>
                <phase>post-integration-test</phase>
                <goals>
                  <goal>stop</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <container>
                <type>installed</type>
                <containerId>tomcat8x</containerId>
                <append>false</append>
                <home>${tomcat.runtime}</home>
                <timeout>${cargo.timeout}</timeout>
              </container>
              <configuration>
                <type>standalone</type>
                <home>${project.build.directory}/config-tomcat</home>
                <properties>
                  <cargo.servlet.port>${tomcat.connector.http.port}</cargo.servlet.port>
                  <cargo.tomcat.ajp.port>${tomcat.connector.ajp.port}</cargo.tomcat.ajp.port>
                </properties>
              </configuration>
              <deployables>
                <deployable>
                  <groupId>org.camunda.bpm.webapp</groupId>
                  <artifactId>camunda-webapp-tomcat-standalone</artifactId>
                  <type>war</type>
                  <pingURL>http://localhost:${tomcat.connector.http.port}/camunda</pingURL>
                  <pingTimeout>${cargo.deploy.timeout}</pingTimeout>
                  <properties>
                    <context>camunda</context>
                  </properties>
                </deployable>
              </deployables>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>webapps-integration-sa</id>
      <build>
        <plugins>

          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <configuration>
              <cleanupDaemonThreads>false</cleanupDaemonThreads>
              <includeProjectDependencies>true</includeProjectDependencies>
              <includePluginDependencies>false</includePluginDependencies>
              <classpathScope>test</classpathScope>
            </configuration>
            <executions>
              <execution>
                <id>setup-tests</id>
                <goals>
                  <goal>java</goal>
                </goals>
                <phase>pre-integration-test</phase>
                <configuration>
                  <mainClass>org.camunda.bpm.SetupTests</mainClass>
                </configuration>
              </execution>
            </executions>
          </plugin>

          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-failsafe-plugin</artifactId>
            <version>3.0.0-M3</version>
            <configuration>
              <redirectTestOutputToFile>true</redirectTestOutputToFile>
              <dependenciesToScan>
                <dependency>org.camunda.bpm.qa:camunda-qa-integration-tests-webapps</dependency>
              </dependenciesToScan>
              <systemPropertyVariables>
                <selenium.screenshot.directory>${project.build.directory}/selenium-screenshots</selenium.screenshot.directory>
              </systemPropertyVariables>
            </configuration>
            <executions>
              <execution>
                <id>default</id>
                <phase>integration-test</phase>
                <configuration>
                  <skipTests>false</skipTests>
                  <excludes combine.children="append">
                    <exclude>**/RestIT.*</exclude>
                    <exclude>**/RestJaxRs2IT.*</exclude>
                  </excludes>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

  <build>
    <testResources>
      <testResource>
        <directory>src/test/resources</directory>
        <filtering>true</filtering>
      </testResource>
    </testResources>
  </build>

</project>
